<?php echo View::make('admin.common.header'); ?>

<div id="header">
    <?php echo View::make('admin.common.category')->with('data',$data); ?>
    <div class="fr1">

        <div class="main-content">

            <div class="box-positon">
                <div class="rpos">当前位置: 视频分类管理</div>
                <form class="ropt" action="/admin/category/index">
                    <input type="submit" value="返回列表" class="return-button">
                </form>
                <div class="clear"></div>
            </div>

            <div class="toast" id="toast">
                <!--{$msg}-->
            </div>

            <div class="body-box">
                <form method="post" action="/admin/category/manage" id="jvForm">
                    <table width="100%" class="pn-ftable" cellpadding="2" cellspacing="1" border="0">
                        <tr>
                            <td width="10%" class="pn-flabel pn-flabel-h">选择分类:</td>
                            <td colspan="3" width="90%" class="pn-fcontent ums-category">
                                        <?php $count = 1;if (!empty($brothers)): foreach($brothers as $key => $values): ?>
                                <span class="ums-cat">
                                    <select name="super" id="top-cat" class="cat-select">
                                        <option value=""><?php echo $count;?>级分类</option>
										<?php $count += 1;foreach($values as $k => $value):?>

										<?php if ($value['id'] == $key){ ?>
                                        <option selected value="<?php echo $value['id'];?>"><?php echo $value['name'];?></option>
										<?php }else{?>	
                                        <option value="<?php echo $value['id'];?>"><?php echo $value['name'];?></option>
										
										<?php }?>	
										<?php endforeach;?>
                                    </select>
                                </span> 

							<?php endforeach; endif; ?>

                                        <?php if (!empty($top_cat)):?>
                                <span class="ums-cat">
                                    <select name="super" id="top-cat" class="cat-select">
                                        <option value="">1级分类</option>
										<?php foreach ($top_cat as $cat): ?>
                                                <option value="<?php echo $cat->id; ?>"><?php echo $cat->name; ?></option>
                                            <?php endforeach; ?>
                                    </select>
                                </span> 
											<?php endif; ?>

                                <span style="margin-left:40px;" class="error" id="cat-info"></span>
                                <input type="hidden" name="catgory_id" value="" id="category_id">
                            </td>

                        <tr>
                            <td width="10%" class="pn-flabel pn-flabel-h"><span class="pn-frequired">*</span>分类名称:</td>
                            <td colspan="3" width="100%" class="pn-fcontent">
                                <input type="text" maxlength="100" name="name" id="name" class="required" style="width:350px;" value="" />
                            </td>
                        </tr>
                        <tr>
                            <td width="10%" class="pn-flabel pn-flabel-h">分类排序值:</td>
                            <td colspan="3" width="90%" class="pn-fcontent">
                                <input type="text" maxlength="3" name="sort" id="sort" class="required" style="width:50px;" value="" />
                            </td>
                        </tr>
                    </table>
            </div>

            <table width="100%" class="pn-ftable" cellpadding="2" cellspacing="1" border="0">
                <tr>
                    <td colspan="4" class="pn-fbutton">
                        <span class="error" style="padding-left:100px;" id="error">
                            <!--{$error}-->
                        </span>
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="pn-fbutton">
                        <input type="hidden" name="picture" value="" id="picture">
                        <input type="hidden" name="id" value="<?php if(isset($id)&&!empty($id)) echo $id;?>">
                        <input type="hidden" name="do" value="save">
                        <input type="submit" value="提交" class="submit" class="submit" id="submit"/> &nbsp; 
                        <input type="reset" value="重置" class="reset" class="reset"/>
                    </td>
                </tr>
            </table>
            </form>
        </div>

    </div>

</div>    
</div>

<?php echo View::make('admin.common.footer'); ?>

<script type="text/javascript">
    $(document).ready(function() {
        $("select.cat-select").select2();
    });
    setTimeout(function() {
        umams.admin.Operate.initCategoryEvent();
    }, 1000);
</script>
